//
//  ListTableViewCell.m
//  艾听歌
//
//  Created by dllo on 16/5/20.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ListTableViewCell.h"

@implementation ListTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.pic = [[UIImageView alloc] init];
//        self.pic.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:self.pic];
        
        self.BigLabel = [[UILabel alloc]init];
//        self.BigLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.BigLabel];
        self.BigLabel.font = [UIFont systemFontOfSize:22];
        
        self.singerLabel = [[UILabel alloc] init];
//        self.singerLabel.backgroundColor = [UIColor blueColor];
        [self.contentView addSubview:self.singerLabel];
        self.singerLabel.font = [UIFont systemFontOfSize:15];
        
        
        self.singlabel = [[UILabel alloc] init];

        [self.contentView addSubview:self.singlabel];
        self.singlabel.font = [UIFont systemFontOfSize:15];
        
        self.sinLabel = [[UILabel alloc] init];
//        self.sinLabel.backgroundColor = [UIColor blueColor];
        [self.contentView addSubview:self.sinLabel];
        self.sinLabel.font = [UIFont systemFontOfSize:15];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.pic.frame = CGRectMake(5, 10, WIDTH / 4, 120);
    self.BigLabel.frame = CGRectMake(110, 10, WIDTH / 2, 30);
    self.singerLabel.frame = CGRectMake(110, 60, WIDTH / 2 , 15);
    self.singlabel.frame = CGRectMake(110, 80, WIDTH / 2, 15);
    self.sinLabel.frame = CGRectMake(110, 100, WIDTH / 2, 15);
}


- (void)setCellModel:(ListModel *)cellModel{
    
    _cellModel = cellModel;
    
    NSString *imageStr = [_cellModel.image objectForKey:@"pic"];
    [self.pic sd_setImageWithURL:[NSURL URLWithString:imageStr]];
    
    self.BigLabel.text = _cellModel.title;
    
    SongsModel *firstModel = [_cellModel.songs firstObject];
    NSString *nameStr1 = firstModel.name;
    nameStr1 = [NSString stringWithFormat:@"1.%@", nameStr1];
    nameStr1 = [NSString stringWithFormat:@"%@--%@",nameStr1,firstModel.singerName];
    self.singerLabel.text = nameStr1;
    
    
    SongsModel *secondModel = [_cellModel.songs objectAtIndex:1];
    NSString *nameStr2 = secondModel.name;
    nameStr2 = [NSString stringWithFormat:@"2.%@", nameStr2];
    nameStr2 = [NSString stringWithFormat:@"%@--%@",nameStr2, secondModel.singerName];
    self.singlabel.text = nameStr2;

    
    SongsModel *thirdModel = [_cellModel.songs objectAtIndex:2];
    NSString *nameStr3 = thirdModel.name;
    nameStr3 = [NSString stringWithFormat:@"3.%@", nameStr3];
    nameStr3 = [NSString stringWithFormat:@"%@--%@",nameStr3, thirdModel.singerName];
    self.sinLabel.text = nameStr3;

    
}





@end
